using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

using GURUCORE.Framework.Core.Util.Localization;

namespace GURUCORE.Portal.AspNet.Control.Localized
{	
	public class LocalizedCheckBox : CheckBox, ILocalizable
	{		
		protected override void Render(HtmlTextWriter writer) 
		{
			if (HttpContext.Current != null)
			{
				System.Web.UI.Control ctlNamingContainer = this.NamingContainer;
				if (ctlNamingContainer == null)
				{
					base.Render(writer);
					return;
				};
				while (!((ctlNamingContainer is UserControl) || (ctlNamingContainer is Page)))
				{
					ctlNamingContainer = ctlNamingContainer.NamingContainer;
					if (ctlNamingContainer == null)
					{
						base.Render(writer);
						return;
					};
				}

				string sText = ResourceManager.GetString(ctlNamingContainer.GetType().BaseType.FullName, this.ID);
				if (sText != string.Empty)
				{
					base.Text = sText;
				}
			}
			base.Render (writer);
		}
	}
}
